package com.pc.service.impl;

import com.pc.enrty.User;
import com.pc.mapper.UserMapper;
import com.pc.pojo.Basic;
import com.pc.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;

@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserMapper userMapper;
    @Override
    public ArrayList<User> findByUsernameAndPassword(User user) {
        return userMapper.selectByUsernameAndPassword(user);
    }

    public ArrayList<User> findByUsername(User user) {
        return userMapper.selectByUsername(user);
    }

    @Override
    public boolean addUser(User user) {
        return userMapper.insertUser(user)==1?true:false;
    }

    @Override
    public boolean updateNickName(User user) {
        return userMapper.insertUser(user)==1?true:false;
    }

    @Override
    public ArrayList<Basic> qureyPhoneById(User user) {
        return userMapper.selectBasicByid(user);
    }
}
